﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.Chirash.Twitter.TwitterClient;
using Net.Chirash.Twitter.TwitterDatabase;

namespace Net.Chirash.Twitter.TweetZone.WindowComponents.ViewModels
{
    public class SearchContainerViewModel : Net.Chirash.Twitter.TweetZone.WindowComponents.ViewModels.TwitterContainerViewModel<Status>
    {
        #region Constructors

        public SearchContainerViewModel()
            : base()
        {
            this.TwitterCommand = TwitterCommandFactory.CreateLocalTwitterCommand();
        }

        #endregion

        #region Public Properties

        #region public string QueryString { get; set; }
        private string _QueryString;
        public string QueryString
        {
            get { return _QueryString; }
            set { _QueryString = value; OnPropertyChanged("QueryString"); }
        }
        #endregion

        public override string ContainerTitle
        {
            get
            {
                return "HashTag Search";
            }
        }

        #endregion

        #region Protected Methods

        protected override void UpdateDatabase(TwitterCaching caching, IEnumerable<Status> updatelist)
        {
            // do nothing
        }

        protected override void RefreshDataProviding(RefreshArgs<Status> e)
        {
            //e.ResultEnumerable = new Status[0];
            //if (!string.IsNullOrWhiteSpace(QueryString))
            //{
            //    var caching = (e.TwitterCommand as TwitterCaching) ?? TwitterCommandFactory.CreateLocalTwitterCommand();
            //    var list = caching.GetStatusByHashTag(QueryString.Split(' ', '　'));//半角と全角スペース
            //    e.ResultEnumerable = list;
            //}
        }

        #endregion
    }
}
